package com.example.controller;


import cn.hutool.core.date.DateUtil;
import com.example.entity.PushMessage;
import com.example.service.PushMessageServiceImpl;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @author 叶凯乐
 */
@Controller
@CrossOrigin(allowCredentials = "true",allowedHeaders = "*")
public class PushMessageController {

    @Resource
    private PushMessageServiceImpl pushMessageService;

    @PostMapping("/adminPushMessage")
    @ResponseBody
    public boolean push(PushMessage message){
        message.setPushTime(DateUtil.now());
        return pushMessageService.pushMessage(message);
    }

}
